from feed import check_feed
from config import CHANNELS
from menu import show_menu


def start():
    channel_titles = []
    all_video_links = []
    all_video_titles = []

    for channel_id in CHANNELS:
        feed = check_feed(channel_id)
        channel_titles.append(feed["info"]["channel_title"])
        links = []
        titles = []

        for item in feed["videos"]:
            links.append(item["link"])
            titles.append(item["title"])

        all_video_links.append(links)
        all_video_titles.append(titles)

    show_menu(channel_titles, all_video_titles, all_video_links)


if __name__ == '__main__':
    print("Starting the program. Please wait...")
    while True:
        start()
